public class test {
    public static void main(String[] args) {
        //求水仙花数
        for(int i = 1 ; i < 99999 ; i++){
            int tmp = i;
            //记录位数
            int count = 0;
            //求位数
            while(tmp != 0){
                count++;
                tmp /= 10;
            }
            tmp = i;
            //求和
            int sum = 0;
            while(tmp != 0){
                sum += Math.pow(tmp % 10,count);
                tmp /= 10;
            }
            if(sum == i){
                System.out.println(i);
            }
        }
    }
}
